Improve 'key-translate' to support removing translations
authorCharalampos Mitrodimas <charmitro@posteo.net>
Tue, 2 Apr 2024 19:02:46 +0000 (19:02 +0000)
committerEli Zaretskii <eliz@gnu.org>
Thu, 23 May 2024 13:16:34 +0000 (16:16 +0300)
commit8f010e9a2926bd3886c54a0360ff341bc66f8088
tree8647d6745a1e27a137a68c59fbabf0e7d8ae6193
parenta2ca5d01989cbe8d43f7763aa5ac374b49980c39
Improve 'key-translate' to support removing translations

This patch enhances the key-translate function to allow removing
keyboard translations by passing nil as the second argument (TO).
If TO is nil, any existing translation for the FROM key will be
removed.  The compiler macro is updated to only check TO when it
is non-nil.  This change makes key-translate more consistent with
the behavior of 'keyboard-translate', providing a way to remove
translations without having to specify the same key for both FROM
and TO.
The documentation string is updated to reflect the new behavior.

* lisp/keymap.el (key-translate): Support removing translations
by passing nil as the second argument (TO).  Also signal an error
if multiple items are passed.  (Bug#70139)
lisp/keymap.el